package com.dwxt.cdms.controller;

import com.dwxt.cdms.entity.ElectronicFence;
import com.dwxt.cdms.service.ElectronicFenceService;
import com.dwxt.common.base.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/*
 * @Author liuhongfei 电子围栏
 * @Description
 * @Date 17:20 2020/9/24
 * @Param
 * @return
 */

@RestController
@RequestMapping("/cdms/electronicFence")
public class ElectronicFenceController {

    @Autowired
    private ElectronicFenceService electronicFenceService;

    @RequestMapping("/insertOrUpdate")
    public BaseResult insertOrUpdate(ElectronicFence electronicFence){
        return electronicFenceService.insertOrUpdate(electronicFence);
    }

    /**
     * @方法名：isEnabledElectronicFence
     * @描述： 启用或禁用电子围栏
     * @作者： kjz
     * @日期： Created in 2020/9/25 17:02
     */
    @RequestMapping("/isEnabledElectronicFence")
    public BaseResult isEnabledElectronicFence(Integer customerId){
        return BaseResult.ok(electronicFenceService.isEnabledElectronicFence(customerId));
    }

    @RequestMapping("/selectFenceById")
    public BaseResult selectFenceById(Integer id){
        return BaseResult.ok(electronicFenceService.selectFenceById(id));
    }

    @RequestMapping("/deleteById")
    public BaseResult deleteById(Integer id){
        return BaseResult.ok(electronicFenceService.delete(id));
    }

    @RequestMapping("/selectFenceByCustomerId")
    public BaseResult selectFenceByCustomerId(Integer customerId){
        return BaseResult.ok(electronicFenceService.selectFenceByCustomerId(customerId));
    }

}
